home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / amiga / ilocale.c < prev    next >
C/C++ Source or Header  |  1997-09-09  |  1KB  |  59 lines

  1.  
  2. /*
  3.  * ILOCALE.C
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  *
  9.  * Internationalization auto-load, brought in by DCC
  10.  */
  11.  
  12. #include <exec/types.h>
  13. #include <clib/locale_protos.h>
  14. #include <stdio.h>
  15.  
  16. extern long _AutoLocale[];
  17. extern struct Library *LocaleBase;
  18.  
  19. static APTR Catalog;
  20. static APTR Locale;
  21.  
  22. __autoexit static void
  23. ILocaleExit(void)
  24. {
  25.     if (Catalog) {
  26.     CloseCatalog(Catalog);
  27.     Catalog = NULL;
  28.     }
  29.     if (Locale) {
  30.     CloseLocale(Locale);
  31.     Locale = NULL;
  32.     }
  33. }
  34.  
  35. int
  36. SetCatalog(char *localeName, char *catName)
  37. {
  38.     int r = 0;
  39.  
  40.     ILocaleExit();
  41.     if (LocaleBase) {
  42.     Locale = OpenLocale(localeName);
  43.     r = 1;
  44.     if (Catalog = OpenCatalogA(Locale, catName, NULL)) {
  45.         long *al;
  46.  
  47.         r = 2;
  48.  
  49.         for (al = _AutoLocale + 1; *al; al += 2) {
  50.         printf("%s ->", (char *)*al);
  51.         *al = GetCatalogStr(Catalog, al[1], (char *)al[0]);
  52.         printf("%s\n", (char *)*al);
  53.         }
  54.     }
  55.     }
  56.     return(r);
  57. }
  58.  
  59.